package com.mall.shopping.converter;

import com.mall.shopping.dal.entitys.Item;
import com.mall.shopping.dal.entitys.ItemDesc;
import com.mall.shopping.dto.ProductDetailDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

/**
 * @author zhuyongxin
 * @version 1.0.0
 * @Description TODO
 * @createTime 2022年01月19日 23:26:00
 */
@Mapper(componentModel = "spring")
public interface ShoppingProductConverter {
    @Mappings({
            @Mapping(source = "itemDesc.itemDesc",target = "detail"),
            @Mapping(source = "itemDesc.itemId",target = "productId"),
            @Mapping(source = "item.limitNum",target = "limitNum"),
            @Mapping(source = "item.imageBig",target = "productImageBig"),
            @Mapping(source = "item.imagesSmall",target = "productImageSmall"),
            @Mapping(source = "item.title",target = "productName"),
            @Mapping(source = "item.price",target = "salePrice"),
            @Mapping(source = "item.sellPoint",target = "subTitle")
    }
    )
    ProductDetailDto itemAndDesc2Dto(Item item, ItemDesc itemDesc);


}
